package com.mindskip.xzs.utility.excel;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import org.springframework.stereotype.Component;


/**
 * <p>
 * 针对JDK8的LocalDate类型，easyexcel默认的类型转换器是无法处理的，要自行编写转换器
 * </p>
 *
 * @author guoguangkai
 * @since 2022/1/25
 */
@Component
public class BooleanConverter implements Converter<Boolean> {

    @Override
    public WriteCellData<Boolean> convertToExcelData(Boolean value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
        return new WriteCellData<Boolean>(
                value ? "是" : "否"
        );
    }
}
